package com.wcl.nullmusic.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * Created by dllo on 16/1/16.
 */
public class UrlUtils {

    //将普通字符串转换成
    //application/x-www-form-urlencoded字符串
    public static final String toEncoder(String url) {
        try {
            return URLEncoder.encode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    //将application/x-www-form-urlencoded字符串
    //转换成普通字符串
    public static final String toDecoder(String url) {
        try {
            return URLDecoder.decode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
}
